#ifndef MOUSECONTROLLER_H
#define MOUSECONTROLLER_H

#include "scene/wsyscene.h"
#include "geometry/vertex3D.h"

#include <QtEvents>

#include <QObject>
#include <QtWidgets>

/**
 * 鼠标移动的控制器
 * @brief The MouseController class
 */
class MouseController : public QObject {
public:
    MouseController(WSYScene *scene_0, QWidget *widget_0) {
        scene = scene_0;
        widget = widget_0;
    }
    virtual ~MouseController(){}
    /** 鼠标移动的事件 */
    virtual void mouseMoveEvent(QMouseEvent *event);
    /** 鼠标按下的事件 */
    virtual void mousePressEvent(QMouseEvent *event);
    /** 鼠标松开的事件 */
    virtual void mouseReleaseEvent(QMouseEvent *event);
private:
    Vector3D *up; //向上的焦点
    Vertex3D *lookAt; //摄像机的焦点
    double lookAtCameraDistance = 1; //焦点与摄像机的距离
    double initialAngle = 0; //起始角度
    Vector3D *dirX0, *dirY0, *dirZ0; //参考X轴、Y轴、Z轴
protected:
    int initX = 0; //X的初始位置
    int initY = 0; //Y的初始位置
    WSYScene *scene; //王诗阳专用场景
    QWidget *widget; //由众多部件继承的小部分，包含宽度和高度两种属性
    boolean mousePressed = false; //鼠标是否按下
};

#endif // MOUSECONTROLLER_H
